public class SwapPairs {
    // leetcode 两两交换链表中的节点
    // https://leetcode.cn/problems/swap-nodes-in-pairs/description/?envType=study-plan-v2&envId=top-100-liked
    public ListNode swapPairs(ListNode head) {
        if (head == null || head.next == null) return head;
        ListNode next = swapPairs(head.next.next);
        ListNode nextCur = head.next;
        head.next.next = head;
        head.next = next;
        return nextCur;
    }
}
